package com.mytoutou.playermanager.player_manager.player_messages;





import com.mytoutou.playermanager.player_manager.manager.VideoPlayerManagerCallback;
import com.mytoutou.playermanager.player_manager.ui.VideoPlayerView;
import ohos.global.resource.BaseFileDescriptor;
import ohos.global.resource.RawFileDescriptor;

/**
 * This PlayerMessage calls {@link ohos.media.player.Player#setSource(BaseFileDescriptor)} (FileDescriptor)} on the instance that is used inside {@link VideoPlayerView}
 */
public class SetAssetsDataSourceMessage extends SetDataSourceMessage{

    private final RawFileDescriptor mAssetFileDescriptor;

    public SetAssetsDataSourceMessage(VideoPlayerView videoPlayerView, RawFileDescriptor assetFileDescriptor, VideoPlayerManagerCallback callback) {
        super(videoPlayerView, callback);
        mAssetFileDescriptor = assetFileDescriptor;
    }

    @Override
    protected void performAction(VideoPlayerView currentPlayer) {
        currentPlayer.setDataSource(mAssetFileDescriptor);
    }
}
